import React, { Component } from 'react'
import axios from 'axios'

export default class App extends Component {
	render() {
		return (
			<div>
				<button onClick={this.getStudent}>点我获取学生数据</button>
				<button onClick={this.getCar}>点我获取汽车数据</button>
			</div>
		)
	}

	getStudent = ()=>{
		axios.get('http://localhost:3000/demo/students').then(
			response => {console.log('请求成功了',response.data)},
			error => {console.log('请求失败了',error.message)}
		)
	};

	getCar = ()=>{
		axios.get('http://localhost:3000/test/cars').then(
			response => {console.log('请求成功了',response.data)},
			error => {console.log('请求失败了',error.message)}
		)
	}
}
